package com.zj.aop;

import org.springframework.aop.ThrowsAdvice;

import java.lang.reflect.Method;

public class ThrowAdvice implements ThrowsAdvice {

    //注意方法名不能变，异常类型要注意匹配
    public void afterThrowing(Exception ex) throws Throwable {
        // Do something with remote exception
        System.out.println("异常通知。" + ex.getMessage());
    }

//    public void afterThrowing(Method m, Object[] args, Object target, Exception ex) {
//        // Do something with all arguments
//        System.out.println(m.getName()+"异常通知。"+ex.getMessage());
//    }
}
